<?php

namespace App\Service\Index\v1_2_0;

use App\Model\VideoCall;
use App\Model\VoiceCall;
use App\Service\BaseService;

/**
 * 查询当前通话状态
 */
class CheckCallStatusService extends BaseService
{
    public function handle()
    {
        $userId = $this->getUserId();
        $ret['call_status'] = (VoiceCall::checkUserChatting($userId)
            || VideoCall::checkUserChatting($userId)) ? 1 : 0;
        $ret['tip'] = $ret['call_status'] == 1 ? '你当前正在通话中~' : '';
        return $ret;
    }
}
